package com.fwj.authorization.staff.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fwj.authorization.staff.entity.SysPermission;
import com.fwj.authorization.staff.entity.SysRole;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 权限
 *
 * @author 樊温军
 * @date 2025/3/18 上午10:32
 */
@Repository
public interface SysPermissionMapper extends BaseMapper<SysPermission> {

    /**
     * 权限码—分页
     *
     * @param page          分页
     * @param sysPermission 查询条件
     * @return IPage<SysPermission>
     */
    IPage<SysPermission> getPage(Page<SysPermission> page, @Param("map") SysPermission sysPermission);

    /**
     * 根据用户ID获取该用户所有角色
     */
    List<SysRole> getRoleListByPermissionUrl(@Param("permissionUrl") String permissionUrl);

}
